package com.sg.fileService.util;

import org.apache.commons.lang3.StringUtils;

import com.sg.fileService.config.Property;

import it.sauronsoftware.jave.EncoderException;
import it.sauronsoftware.jave.EncodingAttributes;
import it.sauronsoftware.jave.InputFormatException;
import it.sauronsoftware.jave.VideoAttributes;
import it.sauronsoftware.jave.VideoSize;

/**
 * 音视频转换-截取视频图片实现类
 * @author xzk
 * @version 1.0
 * @date 20180224
 *
 */
public class PNGAVEncoder extends AbsAVEncoder{
	
	public PNGAVEncoder() {
		super("image2",Property.IMG_FORMAT_TYPE);
	}


	/**
	 * 视屏转换参数设置
	 * @param videoSize
	 * @throws IllegalArgumentException
	 * @throws InputFormatException
	 * @throws EncoderException
	 */
	@Override
	public EncodingAttributes initEncodeAttr(VideoSize videoSize){
		   
	        
	        //设置视频参数
	        VideoAttributes video = new VideoAttributes();
	        //如果为空则使用默认分辨率
	        if(videoSize!=null){
	        	video.setSize(videoSize);//-s width,height
	        }
	        
	        //设置转换器参数
	        EncodingAttributes attrs = new EncodingAttributes();
	        attrs.setDuration(0.01f);//-t
	        attrs.setFormat(super.format);//-f
	        attrs.setVideoAttributes(video);
	        
	        return attrs;
	}
}
